<%@ page language="java" pageEncoding="UTF-8"%>
<%@page import="com.shsh.safemanage.model.ProblemBrowseCondition"%>
<%@page import="java.util.Calendar"%>
<%@page import="com.shsh.safemanage.dao.EquipmentDao"%>
<%@page import="com.shsh.safemanage.model.Equipment"%>
<%@page import="java.util.List"%>
<%@page import="com.shsh.safemanage.dao.DaoCreator"%>
<%@page import="com.shsh.safemanage.dao.DepartmentDao"%>
<%@page import="com.shsh.safemanage.model.Department1"%>
<%@page import="com.shsh.safemanage.model.TendencyType"%>

<%
DepartmentDao departmentDao = DaoCreator.createDepartmentDao();
EquipmentDao equipmentDao = DaoCreator.createEquipmentDao();
ProblemDao problemDao = DaoCreator.createProblemDao();

List<TendencyType> tendencyTypeList = problemDao.getTendencyTypeList();

String theFromPage = request.getParameter(Constants.REQUEST_PARAMETER_FROM_PAGE);
if (theFromPage == null || !theFromPage.equals("feedback")) {
	session.removeAttribute(Constants.SESSION_TENDENCY_CONDITION);
}
%>
<div class="hider" id="hider">
	<span>&nbsp;</span>
</div>
<div class="position">
	<img src="images/position2.jpg" style="padding: 7px 9px; float: left;" />当前位置：上海高桥分公司问题管理平台
	&gt;&gt; 事苗浏览
</div>
<div class="tt">事苗浏览</div>
<div class="content">
	<div class="apptab">
		<table width="100%" border="0" cellpadding="0" cellspacing="0"
			style="font-size: 12px; color: #000; line-height: 25px;">
			<tr>
				<td width="13" class="appbg">&nbsp;</td>
				<td width="97" class="appbg"><img src="images/trace.gif"
					style="vertical-align: middle;" />查询条件</td>
				<td width="554" class="appbg">&nbsp;</td>
				<td colspan="2" class="appbg">&nbsp;</td>
			</tr>
			<tr>
				<td width="13" height="40">&nbsp;</td>
				<td colspan="3">
					<span style="margin-left: 30px">作业部：</span>
					<span> 
					<%@include file="depart_select/depart1_shiyebu_select_section.jsp"%>
					</span> 
					<span style="margin-left: 10px">装置：</span> 
					<span id="equipOfDepartSpan">
						<%@include file="equip_select/equipment_of_depart_select_section.jsp"%>
					</span>				
					<br />
					<span style="margin-left: 30px">事苗类型：</span>						
					<span>
					<select id="tendencyType">
						<option value="0">请选择事苗类型</option>
						<%for (TendencyType tendencyType : tendencyTypeList) {%>
						<option value="<%=tendencyType.getId()%>"><%=tendencyType.getTendencyType()%></option>
						<%} %>
					</select>
					</span>
					<br/>
					
					<span style="margin-left: 30px">事苗名称： </span><input type="text" size="15" id="problemTitle" />
					<span style="margin-left: 10px">事苗经过： </span><input type="text" size="25" id="problemContent" />
					<font color="#666666">（可模糊查询相关文字）</font>
					
					<br />
					
					<span style="margin-left: 30px">填报日期区间：</span> <input type="text" id="dateStart"
					size="15"
					onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'dateStart\')||\'2050-12-31\'}'})" />-<input
					type="text" id="dateEnd" size="15"
					onfocus="WdatePicker({minDate:'#F{$dp.$D(\'dateEnd\')}',maxDate:'2050-12-31'})" />
				</td>
				<td width="14">&nbsp;</td>
			</tr>
			<tr>
				<td width="13" height="40">&nbsp;</td>
				<td colspan="3" style="text-align: center;"><a
					href="javascript:" onclick="browseProblems()"><img
						src="images/cha.gif" /></a></td>
				<td width="14">&nbsp;</td>
			</tr>
			<%
			Calendar now = Calendar.getInstance();
			%>
			<tr>
				<td width="13" height="30">&nbsp;</td>
				<td style="border: 1px #E3E3E3 solid" class="a_text1">【<%=now.get(Calendar.YEAR)%>年度】
				</td>
				<td style="border: 1px #E3E3E3 solid; border-left: 0px;"
					class="a_text1"><span><input
						name="button" type="button" class="a_but" id="button" value="全部" /> 【<%=now.get(Calendar.MONTH)+1%>月份】</span>
				</td>
				<td width="52" style="border: 1px #E3E3E3 solid; border-left: 0px;"></td>
				<td width="14">&nbsp;</td>
			</tr>
			<tr>
				<td colspan="5" height="20">&nbsp;</td>
			</tr>
		</table>
	</div>
	<div class="apptab" id="tendencyBrowseListTD">
	<%@include file="tendency_list.jsp"%>
	</div>
</div>

<script type="text/javascript">
	function browseProblems() {
		openWaitingDialog('waitingDialog');
		loadPageSection('<%=request.getContextPath()%>/tendency_search_list.jsp', 'tendencyBrowseListTD',
				{
					departmentID : getElementValueByID('depart1'),
					equipID : getElementValueByID('equipID'),
					problemTitle : getElementValueByID('problemTitle'),
					problemContent : getElementValueByID('problemContent'),
					tendencyTypeID : getElementValueByID('tendencyType'),
					dateStart : getElementValueByID('dateStart'),
					dateEnd : getElementValueByID('dateEnd'),
					manageGroupID : getElementValueByID('manageGroupID')
				});
	}

	function selectDepart1() {
		loadPageSection(
				'<%=request.getContextPath()%>/equip_select/equipment_of_depart_select_section.jsp',
				'equipOfDepartSpan', {
					depart1ID : getElementValueByID('depart1')
				}, false, function() {
					document.getElementById('equipID').value = '';
				});
		loadPageSection(
				'<%=request.getContextPath()%>/managegroup_select/manage_group_select_section.jsp',
				'manageGroupSpan', {
					depart1ID : getElementValueByID('depart1')
				}, false, function() {
					document.getElementById('manageGroupID').value = '';
				});
	}

	selectDepart1();
</script>
